
#include "any.h"

#include <typeinfo>
#include <utility>

any::any ( void )
: value_ ( NULL )
{

}


any::any ( const any & other )
: value_ ( other.value_ ? other.value_->clone() : NULL )
{

}


any::~any ( void )
{
	delete this->value_;
}


any & any::swap ( any & rhs )
{
	std::swap ( this->value_, rhs.value_ ) ;
	return *this;
}


any & any::operator = ( const any & rhs )
{
	any ( rhs ).swap ( *this ) ;
	return *this;
}


bool any::empty ( void ) const
{
	return ! this->value_ ;
}

const std::type_info & any::type ( void ) const
{
	return this->value_ ? this->value_->type() : typeid(void);
}
